package com.kaifamiao.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;

public class JdbcTest01 {
    public static void main(String[] args) throws Exception {
        String driver = "com.mysql.cj.jdbc.Driver" ;
        String url = "jdbc:mysql://localhost:3306" ;
        String username = "root";
        String password = "" ;

        // 加载驱动类(实际上还创建了驱动类的实例并向DriverManager注册了该实例)
        Class.forName( driver );
        // 获得数据库连接
        Connection conn = DriverManager.getConnection( url , username , password );
        System.out.println( conn );
        conn.close();
    }
}
